home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / newsgroups / misc.19950528-19950726 / 000388_news@columbia.edu_Tue Jul 18 13:19:38 1995.msg < prev    next >
Internet Message Format  |  2020-01-01  |  2KB

  1. Received: from apakabar.cc.columbia.edu by watsun.cc.columbia.edu with SMTP id AA01811
  2.   (5.65c+CU/IDA-1.4.4/HLK for <kermit.misc@watsun.cc.columbia.edu>); Tue, 18 Jul 1995 13:51:17 -0400
  3. Received: by apakabar.cc.columbia.edu id AA17822
  4.   (5.65c+CU/IDA-1.4.4/HLK for kermit.misc@watsun); Tue, 18 Jul 1995 13:51:14 -0400
  5. Path: news.columbia.edu!panix!news.mathworks.com!newsfeed.internetmci.com!news.sprintlink.net!howland.reston.ans.net!news1.digex.net!news3.digex.net!digex.net!not-for-mail
  6. From: hashmi@cnj.digex.net (Atiqullah Hashmi)
  7. Newsgroups: comp.protocols.kermit.misc
  8. Subject: dialing program; modem receives dial string but doesn't dialout ?
  9. Date: 18 Jul 1995 09:19:38 -0400
  10. Organization: Express Access Online Communications, New Jersey, USA
  11. Lines: 40
  12. Message-Id: <3ugcda$6uk@cnj.digex.net>
  13. Nntp-Posting-Host: cnj.digex.net
  14. Apparently-To: kermit.misc@watsun.cc.columbia.edu
  15.  
  16.  
  17. Hi,
  18.  
  19. I have a simple program to dial out via a hayes modem. When run, the
  20. modem RD and TD lights blink showing that it receives the dial string
  21. from the program but doesn't really dial out.
  22. Here is the relevant piece of code. Any help is appreciated.
  23. Thanks
  24.  
  25. Atiq
  26. -------------------------------------
  27. void sttyModem(int fd)
  28. {
  29.         struct termio tbuf;
  30.         if (ioctl(fd, TCGETA, &tbuf) < 0 )
  31.                 cerr << "ioctl(TCGETA) failed; errno = "<< errno << endl;
  32.         tbuf.c_iflag = IXON | IXOFF | ISTRIP | IGNBRK | IGNPAR;
  33.         tbuf.c_oflag = 0;
  34.         tbuf.c_lflag = 0;
  35.         tbuf.c_cflag = B300 | CS7 | CREAD | HUPCL | PARENB;
  36.         tbuf.c_cc[4] = 1;       // MIN
  37.         tbuf.c_cc[5] = 0;       // TIME
  38.         if (ioctl(fd, TCSETAF, &tbuf))
  39.                 cerr << "ioctl(TCSETAF) failed; errno = "<< errno << endl;
  40. }
  41.  
  42. main()
  43. {
  44.     int tty_fd;
  45.     tty_fd=open(....)  etc.
  46.     sttyModem(tty_fd);
  47.  
  48.         char *str="ATDT91(800)222-3333\r";        //some number
  49.     char ss[10];
  50.  
  51.         write(tty_fd, str, strlen(str));
  52.         read(tty_fd, ss, 1);
  53.     // other code..........
  54.     exit(0);
  55. }